<?php
	function createAlbum() {
		require_once 'db-connection.php';
		
		if(isset($_POST['name'])) {
			$name = $_POST['name'];
			if(isset($_POST['desc'])) {
				$desc = $_POST['desc'];
				$createAlbum = mysql_query("insert into albums(name, description,userId) values ('$name','$desc',1);")
				or die("Problem Creating album" . mysql_error());
			}
			else {
				$createAlbum = mysql_query("insert into albums(name,userId) values ('$name',1);")
				or die("Problem Creating album" . mysql_error());
			}
			echo "<p>Album Successfully Created!</p><br />";
			echo "<a href='root-user-admin.php' style='background-color:lightblue; font-size:2em; text-decoration:none'>Go Back</a>";
		}
	}
	
	createAlbum();
	
?>